<template>
  <div class="sidebar">
    <el-menu
        class="sidebar-el-menu"
        :default-active="onRoutes"
        :collapse="collapse"
        unique-opened
        router
    >
      <template v-for="item in items">
        <template v-if="item.subs">
          <el-submenu :index="item.index" :key="item.index">
            <template slot="title">
              <i :class="item.icon"></i>
              <span slot="title">{{ item.title }}</span>
            </template>
            <template v-for="subItem in item.subs">
              <el-submenu
                  v-if="subItem.subs"
                  :index="subItem.index"
                  :key="subItem.index"
              >
                <template slot="title">{{ subItem.title }}</template>
                <el-menu-item
                    v-for="(threeItem,i) in subItem.subs"
                    :key="i"
                    :index="threeItem.index"
                >{{ threeItem.title }}
                </el-menu-item>
              </el-submenu>
              <el-menu-item
                  v-else
                  :index="subItem.index"
                  :key="subItem.index"
              >{{ subItem.title }}
              </el-menu-item>
            </template>
          </el-submenu>
        </template>
        <template v-else>
          <el-menu-item :index="item.index" :key="item.index">
            <i :class="item.icon"></i>
            <span slot="title">{{ item.title }}</span>
          </el-menu-item>

        </template>

      </template>
    </el-menu>
  </div>
</template>

<script>
import bus from './bus';

export default {
  data() {
    return {
      collapse: false,
      items: [
        {
          icon: 'el-icon-setting',
          index: '/activity_group',
          title: '活动',
          subs: [
            /*{
                icon: 'el-icon-setting',
                index: '/new_personal_event',
                title: '新个人活动'
            },*/
            {
              icon: 'el-icon-setting',
              index: '/new_personal_event_project_v2',
              title: '新个人活动v2'
            },
            /*{
                icon: 'el-icon-setting',
                index: '/strongest_sheriff',
                title: '最强治安官'
            },*/
            {
              icon: 'el-icon-setting',
              index: '/strongest_sheriff_project_v2',
              title: '最强治安官v2'
            },
            // {
            //     icon: 'el-icon-setting',
            //     index: 'target_activity',
            //     title: '目标型活动'
            // },
            /*{
              icon: 'el-icon-setting',
              index: '/target_activity_proj',
              title: '新目标型活动'
          },*/
            {
              icon: 'el-icon-setting',
              index: '/target_activity_proj_new',
              title: '目标型活动'
            },
            {
              icon: 'el-icon-setting',
              index: '/ava_event_project',
              title: 'AVA'
            },
            {
              icon: 'el-icon-setting',
              index: '/new_al_legion_event_project',
              title: '新军团战'
            },
            {
              icon: 'el-icon-setting',
              index: '/old_al_legion_event_project',
              title: '旧军团战'
            },
            /*{
                icon: 'el-icon-setting',
                index: '/kvk_event_project',
                title: 'kvk'
            },*/
            {
              icon: 'el-icon-setting',
              index: '/kvk_event_project_new',
              title: 'KVK'
            },
            /*{
                icon: 'el-icon-setting',
                index: '/western_shadow_menu_project',
                title: '厄运暗影'
            },*/
            {
              icon: 'el-icon-setting',
              index: '/new_western_shadow_menu_project',
              title: '厄运暗影'
            },
            {
              icon: 'el-icon-setting',
              index: '/match_numerical_conf',
              title: '竞技活动匹配规则'
            },
            {
              icon: 'el-icon-setting',
              index: '/common_buff',
              title: 'buff自动化id'
            },
            {
              icon: 'el-icon-setting',
              index: '/kindom_buff',
              title: '王国buff',
              subs: [
                {
                  icon: 'el-icon-s-tools',
                  index: '/kindom_buff/project',
                  title: '方案'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/kindom_buff/schedule',
                  title: '排期'
                }
              ]
            },
            // {
            //     icon: 'el-icon-setting',
            //     index: 'continuous_activities_new',
            //     title: '多日活动'
            // },
            /*{
                icon: 'el-icon-setting',
                index: '/continuous_activities_proj',
                title: '新多日活动'
            },*/
            {
              icon: 'el-icon-setting',
              index: '/continuous_activities_proj_new',
              title: '多日活动'
            },
            {
              icon: 'el-icon-setting',
              index: '/make_cake_event',
              title: '做蛋糕'
            },
            {
              icon: 'el-icon-setting',
              index: '/lohar_event',
              title: '洛哈'
            },
            {
              icon: 'el-icon-setting',
              index: '/new_index_theme_event_project?event_type=999',
              title: '旧个人主题'
            },
            {
              icon: 'el-icon-setting',
              index: '/new_index_title?event_type=1008',
              title: '鬼镇'
            },
            {
              icon: 'el-icon-setting',
              index: '/new_index_title?event_type=1007',
              title: '土匪来袭'
            },
            {
              icon: 'el-icon-setting',
              index: '/battle_pass',
              title: '普通季卡'
            },
            {
              icon: 'el-icon-setting',
              index: '/extreme_user_event',
              title: '个人/地狱/使命',
              subs: [
                {
                  icon: 'el-icon-s-tools',
                  index: '/extreme_user_event_project',
                  title: '内容配置方案'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/extreme_user_event_schedule', 
                  title: '排期配置方案'
                }
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/event_type_mail_send',
              title: '常驻型邮件'
            },
            {
              icon: 'el-icon-setting',
              index: '/castle_lv',
              title: '新手主城冲刺'
            },
            {
              icon: 'el-icon-setting',
              index: '/territory_event',
              title: '领地法则'
            },
            {
              icon: 'el-icon-setting',
              index: '/backflow_main_proj',
              title: '回归活动'
            },
            // {
            //     icon: 'el-icon-setting',
            //     index: 'zhengduo_project',
            //     title: '失落之地-争夺活动'
            // },
            // {
            //     icon: 'el-icon-setting',
            //     index: 'mubiaoxing_project',
            //     title: '失落之地-目标型活动'
            // },
            // {
            //     icon: 'el-icon-setting',
            //     index: 'xingeren_project',
            //     title: '失落之地-新个人活动'
            // },
            {
              icon: 'el-icon-setting',
              index: '/lost_battlefield',
              title: '失落之地-主活动'
            }, {
              icon: 'el-icon-setting',
              index: '/chronicle_proj',
              title: '失落之地-编年史'
            },
            // {
            //     icon: 'el-icon-setting',
            //     index: 'warrior_journey',
            //     title: '失落之地-勇士征途'
            // },
            {
              icon: 'el-icon-setting',
              index: '/lost_achievenemt',
              title: '失落之地-征战&荣誉录'
            },
            {
              icon: 'el-icon-setting',
              index: '/new_alliance_event',
              title: '新联盟活动'
            },
            {
              icon: 'el-icon-setting',
              index: '/monument',
              title: '博物馆'
            },
            {
              icon: 'el-icon-setting',
              index: '/conquest_match_event_project',
              title: '征服者雄心',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/new_index?event_type=125',
                  title: '方案'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/conquest_match_event_project/score_building',
                  title: '积分建筑配置'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/conquest_match_event_project/test_control',
                  title: '服务器战力配置'
                }
              ]
            },
          ]
        },
        {
          icon: 'el-icon-setting',
          index: '/iap_group',
          title: '内购',
          subs: [
            // {
            //   icon: 'el-icon-setting',
            //   index: '/wg_lucky_card',
            //   title: '翻牌抽奖'
            // },
            // {
            //   icon: 'el-icon-setting',
            //   index: '/wg_lucky_wheel',
            //   title: '轮盘抽奖'
            // },
            {
              icon: 'el-icon-setting',
              index: '/new_wg_lucky_wheel',
              title: '轮盘抽奖'
            },
            {
              icon: 'el-icon-setting',
              index: '/multiday_recharge',
              title: '多日充值'
            },
            {
              icon: 'el-icon-setting',
              index: '/novice_recharge',
              title: '新手目标充值'
            },
            // {
            //   icon: 'el-icon-setting',
            //   index: '/evip_shop_item',
            //   title: 'EVIP打折商店'
            // },
            {
              icon: 'el-icon-setting',
              index: '/new_evip_shop_item',
              title: 'EVIP打折商店'
            },

            {
              icon: 'el-icon-setting',
              index: '/multi_growth_gift_project',
              title: '多开成长基金'
            },
            {
              icon: 'el-icon-setting',
              index: '/recharge_rebate_project',
              title: '充值返利活动'
            },
            {
              icon: 'el-icon-setting',
              index: '/novice_recharge_rebate_project',
              title: '新手定额返利'
            },
            {
              icon: 'el-icon-setting',
              index: '/battle_pass_project',
              title: 'BP卡',
              subs: [
                {
                  icon: 'el-icon-s-tools',
                  index: '/score_theme_battle_pass_project',
                  title: '积分制'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/task_theme_battle_pass_project',
                  title: '任务制'
                }
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/gold_rush_project',
              title: '淘金狂潮'
            },
            {
              icon: 'el-icon-setting',
              index: '/store_treasure_project',
              title: '商城秘宝'
            },
            {
              icon: 'el-icon-setting',
              index: '/duel_yard_event_proj',
              title: '打子弹'
            },
            {
              icon: 'el-icon-setting',
              index: '/customize_iap_project',
              title: '自订礼包'
            },
            {
              icon: 'el-icon-setting',
              index: '/aotu_send',
              title: '推送自动化',
              subs: [
                {
                  icon: 'el-icon-s-tools',
                  index: '/buy_pid_reward_send',
                  title: '邮件推送'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/buy_pid_reward_pid',
                  title: '邮件奖励配置'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/buy_pid_trigger_iap_send',
                  title: '礼包推送'
                }
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/daily_deals_event_project',
              title: '每日特惠'
            },
            {
              icon: 'el-icon-setting',
              index: '/betting_event',
              title: '竞猜活动',
              subs: [
                {
                  icon: 'el-icon-s-tools',
                  index: '/betting_event/project',
                  title: '方案'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/betting_event/schedule',
                  title: '排期'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/betting_event/world_cup_schedule',
                  title: '世界杯赛程'
                }
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/al_pay_gift_project',
              title: '联盟付费赠礼'
            },
            {
              icon: 'el-icon-setting',
              index: '/item_transform',
              title: '道具转化'
            },
            {
              icon: 'el-icon-setting',
              index: '/auction_event_project',
              title: '拍卖活动'
            },
            {
              icon: 'el-icon-setting',
              index: '/joy_event_project',
              title: '消耗活动'
            },
            {
              icon: 'el-icon-setting',
              index: '/new_index?event_type=122',
              title: '储值活动'
            },
            {
              icon: 'el-icon-setting',
              index: '/new_index?event_type=124',
              title: '储值礼包'
            },
            {
              icon: 'el-icon-setting',
              index: '/lucky_purchase',
              title: '幸运采购',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/lucky_purchase/reward_pool',
                  title: '奖池配置'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/new_index?event_type=128',
                  title: '礼包配置'
                }
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/new_index?event_type=127',
              title: '成长阶梯'
            },
            {
              icon: 'el-icon-setting',
              index: '/discount_store',
              title: '打折商城活动',
              subs: [
                {
                  icon: 'el-icon-s-tools',
                  index: '/discount_store/project',
                  title: '方案'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/discount_store/schedule',
                  title: '排期'
                },
                {
                    icon: 'el-icon-setting',
                    index: '/growth_gift_project',
                    title: '成长礼包活动'
                },
              ]
            },
          ]
        },
        {
          icon: 'el-icon-setting',
          index: '/activity_and_iap_group',
          title: '活动内购共用',
          subs: [
            {
              icon: 'el-icon-setting',
              index: '/shop',
              title: '兑换商城',
              subs: [
                {
                  icon: 'el-icon-s-tools',
                  index: '/shop_project',
                  title: '兑换商城方案'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/shop_schedule',
                  title: '兑换商城排期'
                }
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/notice_event',
              title: '预告页'
            },
            {
              icon: 'el-icon-setting',
              index: '/check_tags',
              title: '活动校验'
            },
            {
              icon: 'el-icon-setting',
              index: '/excel_reward_generator',
              title: '奖励配置生成工具'
            },
          ]
        },
        {
          icon: 'el-icon-setting',
          index: '/research_group',
          title: '用研',
          subs: [
            {
              icon: 'el-icon-setting',
              index: '/questionnaire',
              title: '问卷系统',
              subs: [
                {
                  icon: 'el-icon-s-tools',
                  index: '/questionnaire/project',
                  title: '方案'
                },
                {
                  icon: 'el-icon-s-tools',
                  index: '/questionnaire/schedule',
                  title: '排期'
                }
              ]
            },
          ]
        },
        {
          icon: 'el-icon-setting',
          index: '/useless_group',
          title: '暂时不用',
          subs: [
            {
              icon: 'el-icon-setting',
              index: '/mysterious_merchant',
              title: '神秘商人'
            },
            {
              icon: 'el-icon-setting',
              index: '/special_map_dis',
              title: '特殊刷地'
            },
            {
              icon: 'el-icon-setting',
              index: '/template_project',
              title: 't_project'
            },
          ]
        },
        {
          icon: 'el-icon-setting',
          index: '/dynamic_sub_game',
          title: 'dynamic_sub_game',
          subs: [
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/publish',
              title: '导出'
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/activity_group/timesandtreasures',
              title: '活动-时代&宝物',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=troop_control',
                  title: '正式服时代'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=event_svr_conf',
                  title: '战场服时代'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=treasure_control',
                  title: '宝物开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=a3_treasure_open_control',
                  title: '宝物投放内容控制'
                },
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/activity_group/monster',
              title: '活动-野怪相关',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=rebel_control',
                  title: '恶匪帮开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=search_rebel_control',
                  title: '恶匪帮搜索开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=gang_of_bandits_control',
                  title: '匪帮开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=butch_brothers_control',
                  title: '屠夫兄弟帮开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=search_butch_brothers_control',
                  title: '屠夫兄弟帮搜索开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=butcher_house_control',
                  title: '屠夫之屋开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=search_butcher_house_control',
                  title: '屠夫之屋搜索开关'
                },
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/activity_group/newandoldserverstrategy',
              title: '活动-新老服策略区分',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=monument_show_control',
                  title: '博物馆开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=kingdom_old_and_new_server',
                  title: '州府首占奖励新老服配置'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=recommend_sid_control',
                  title: '回流活动移民推荐新老服配置'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=ammunition_supplement',
                  title: '弹药金币补充'
                },
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/activity_group/medal',
              title: '活动-勋章',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=medal_open_control_v3',
                  title: '勋章玩法&建筑开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=medal_id_open_control',
                  title: '勋章分服投放开关'
                },
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/activity_group/other',
              title: '活动-其他',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=vip_lv_open_control',
                  title: 'vip等级段位上限'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=growth_mission',
                  title: '成长任务开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=back_flow_config',
                  title: '回流活动冷却时间'
                },
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/activity_and_iap_group/instructor',
              title: '活动内购共用-教官',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=west_school_open_control',
                  title: '教官玩法开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=school_instructor_open_control',
                  title: '教官分服投放开关'
                },
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/iap_group/recharge',
              title: '内购-充值活动',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=sort_welfare_control',
                  title: '充值活动排序'
                },
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/iap_group',
              title: '内购',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=new_user_guide',
                  title: '新手指引开放等级'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=new_user_show_iap',
                  title: '首充弹出等级'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=cowboy_berserker_control',
                  title: '牛仔狂化限制星级'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=evip_control',
                  title: 'EVIP功能开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=pet_system_open_control',
                  title: '宠物玩法开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=pet_delivery_open_control',
                  title: '宠物投放开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=special_effects_open_control',
                  title: '下雪特效开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=cowboy_id_open_control',
                  title: '英雄投放开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=fetter_id_open_control',
                  title: '羁绊投放开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=cowboy_proficiency_open_control',
                  title: '英雄熟练度投放开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=cowboy_sort_button_open_control',
                  title: '英雄排序按钮开关'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=account_switch_open_control',
                  title: '新切换账号逻辑开关分服开放控制'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=hero_explore_control',
                  title: '远征开关'
                },
              ]
            },
            {
              icon: 'el-icon-setting',
              index: '/dynamic_sub_game/useless_group',
              title: '暂时不用',
              subs: [
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=crystal_synthesis_lv_control',
                  title: '时代4水晶最高合成等级'
                },
                {
                  icon: 'el-icon-setting',
                  index: '/dynamic_sub_game/master?part=mysterious_merchant_control',
                  title: '神秘商人开关'
                },
              ]
            },
          ]
        },


        /*{
          icon: 'el-icon-setting',
          index: '/new_clone_test',
          title: 'clone gen.2'
        },*/
        // 脚本使用，请勿删除此行注释 ly-sidebar  
        {
          icon: 'el-icon-setting',
          index: '/gui_zhen',
          title: '借鬼镇活动测试脚手架'
        },

        {
          icon: '',
          index: '',
          title: ''
        }

      ]
    };
  },
  computed: {
    onRoutes() {
      return this.$route.path.replace('/', '');
    }
  },
  created() {
    // 通过 Event Bus 进行组件间通信，来折叠侧边栏
    bus.$on('collapse', msg => {
      this.collapse = msg;
      bus.$emit('collapse-content', msg);
    });
  }
};
</script>

<style scoped>
.sidebar {
  display: block;
  position: absolute;
  left: 0;
  top: 70px;
  bottom: 0;
  overflow-y: scroll;
}

.sidebar::-webkit-scrollbar {
  width: 0;
}

.sidebar-el-menu:not(.el-menu--collapse) {
  width: 220px;
}

.sidebar > ul {
  height: 100%;
}
</style>
